package com.sxj.consumer.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.rpc.RpcContext;
import com.sxj.product.dto.People;
import com.sxj.product.facade.DubboProviderFacade;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value="/consumer")
@Api(tags = "UserController", description = "用户信息查询")
public class DubboConsumerController {
	
	@Reference(/*url = "dubbo://10.32.41.160:20901", timeout=50000, check=false*/)
	private DubboProviderFacade dubboProviderFacade;
	
	@RequestMapping(value="/test", method=RequestMethod.GET)
	@ApiOperation(value = "dubbo消费者")
	public void getName(){
		People a = new People();
		a.setName("aaa");
		People name = dubboProviderFacade.getName(a);
		System.out.println(name.getName());
		System.out.println(RpcContext.getContext().getAttachment("a"));
	}

}
